<h2>Site Settings</h2>
<table>
    <form id="setting_form" method="post" action="<?php echo base_url(), 'admin/settings/'; ?>">
        <?php foreach ($settings as $setting): ?>
            <?php if ($setting['type'] == 'text'): ?>
                <tr>
                    <td width="30%"><?php echo $setting['title'] ?></td>
                    <td>
                        <input id="<?php echo $setting['name'] ?>" name="<?php echo $setting['name'] ?>" type="<?php echo $setting['type'] ?>" size="50" value="<?php echo $setting['value'] ?>" />
                    </td>
                </tr>
            <?php endif; ?>
            <?php if ($setting['type'] == 'checkbox'): ?>
                <tr>
                    <td width="30%"><?php echo $setting['title'] ?></td>
                    <td>
                        <input id="<?php echo $setting['name'] ?>" name="<?php echo $setting['name'] ?>" type="<?php echo $setting['type'] ?>" 
                               value="<?php echo $setting['value'] ?>" <?php echo $setting['value']==1?'checked="checked"':''; ?> />
                    </td>
                </tr>
            <?php endif; ?>
        <?php endforeach; ?>
        <tr>
            <td><input type="submit" id="setting_submit" name="submit" value="Save settings" /></td>
        </tr>
    </form>
</table>